﻿<UserControl x:Class="PagedDataGridControls.PagedDataGrid"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:SelfControl="clr-namespace:PagedDataGridControls" 
             mc:Ignorable="d" 
             >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="2"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <DockPanel LastChildFill="True">
        <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
            <Button x:Name="butFirst" Width="40" Height="20" Content="&lt;&lt;" Margin="3">
                <!--<Button.Content>
                    <TextBlock Text="First"/>
                </Button.Content>-->
            </Button>
            <Button x:Name="butPrevious" Width="40" Height="20" Content="&lt;"  Margin="3"/>
            <Button x:Name="butNext" Width="40" Height="20" Content="&gt;" Margin="3" />
            <Button x:Name="butLast" Width="40" Height="20" Content="&gt;&gt;" Margin="3"/>
            <TextBlock Text="Records/Page :" VerticalAlignment="Center"/>
            <TextBlock x:Name="txtDataPerPage" 
                       Text="{Binding DataCountPerPage, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}}" 
                       MinWidth="50" VerticalAlignment="Center"/>
            <TextBlock Text="Record count :" Margin="5 0 0 0" VerticalAlignment="Center"/>
            <TextBlock x:Name="txtRecordCount" 
                       Text="{Binding AllRowCount, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}}" 
                       MinWidth="50" VerticalAlignment="Center"/>
            <TextBlock Text="Page count :" Margin="5 0 0 0" VerticalAlignment="Center"/>
            <TextBlock x:Name="txtPageCount" MinWidth="50" VerticalAlignment="Center"/>
            <TextBlock Text="Current Page :" VerticalAlignment="Center"/>
            <ComboBox x:Name="comboGoTo" MinWidth="80" Margin="2" SelectionChanged="comboGoTo_SelectionChanged"/>
        </StackPanel>
            <DataGrid x:Name="dataGrid" Grid.Column="0" Margin="2 0 2 0"
                  ItemsSource="{Binding}"
                  IsReadOnly="True"
                  CanUserAddRows="False"
                  CanUserDeleteRows="False"
                  SelectionChanged="dataGrid_SelectionChanged"
                  x:FieldModifier="public">
            </DataGrid>
        </DockPanel>
        <GridSplitter Grid.Column="0" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="1"/>
        <SelfControl:DetailView Grid.Row="2" Margin="3" x:Name="hostPanel"/>
    </Grid>
</UserControl>
